package main

import (
	"fmt"

	_ "advertoper/adoper"
	"advertoper/banner_manage/bservice"
	_ "advertoper/filmvideo"
	"advertoper/homepageinfo/hservice"
	_ "advertoper/hotactivity"
	_ "advertoper/routers"
	_ "advertoper/servicepage"

	"doubimeizhi.com/utility"

	"github.com/astaxie/beego"
	log "github.com/cihub/seelog"
)

func main() {
	if !utility.CheckAndRecordPid("advertoper_server.pid") {
		fmt.Println("process already exists, so quit")
		return
	}
	logger, err := log.LoggerFromConfigAsFile("conf/seelog.xml")
	if err != nil {
		panic(err)
		return
	}
	log.ReplaceLogger(logger)
	defer logger.Flush()

	//初始化
	hservice.GetZJBannerInfoService()
	hservice.GetZJNewsInfoService()
	hservice.GetZJMultiViewInfoService()
	hservice.GetZJSingleViewInfoService()
	hservice.GetZJTopicInfoService()
	hservice.GetZJGoodsListInfoService()
	hservice.GetZJSeckillInfoService()
	hservice.GetZJPictureInfoService()
	hservice.GetZJPageViewInfoService()
	hservice.GetZJSeckillUserService()

	bservice.GetBannerManageService()

	beego.Run()
	log.Error("Server quit!")
}
